<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
    
     <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<div class="select-list">
						<ul>
							<li>
								试卷名称：<input type="text" name="name"/>
							</li>

							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>

			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var prefix = ctx + "exam/scores";

        $(function() {
            var options = {
                url: ctx + "exam/paperdef/list",
				search: false,
		        showExport: true,
                columns: [
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	actions.push('<a class="btn btn-success btn-xs " href="#" onclick="lookscore(\'' + row.id + '\')"><i class="fa fa-edit"></i> 查看成绩与试卷</a> ');
 						return actions.join('');
		            }
		        },
				{
					field : 'name', 
					title : '试卷名称',
					sortable: true
				},				
				{
					field : 'remark', 
					title : '试卷说明',
					sortable: true
				},
				{
					field : 'status', 
					title : '试卷状态',
					formatter: function(value, row, index) {
						var actions ;
						if(value)  actions='<a class="btn btn-success btn-xs " href="#" >开放</a> ';
						else actions='<a class="btn btn-danger btn-xs " href="#" >关闭</a>';
						return actions;
					}
				},
				{
					field : 'starttime', 
					title : '开始时间',
					sortable: true
				},
				{
					field : 'endtime', 
					title : '结束时间',
					sortable: true
				},
				{
					field : 'duration', 
					title : '考试时长(分钟)',
					sortable: true
				},
				/* {
					field : 'showtime', 
					title : '成绩公布时间',
					sortable: true
				}, */
				{
					field : 'totalScore', 
					title : '卷面总分',
					sortable: true
				},
				{
					field : 'passScore', 
					title : '及格分数',
					sortable: true
				},
				{
					field : 'questionOrder', 
					title : '试题顺序',
					formatter: function(value, row, index) {
						var actions ;
						if(value)  actions='<a class="btn btn-success btn-xs " href="#" >随机</a> ';
						else actions='<a class="btn btn-danger btn-xs " href="#" >原始</a>';
						return actions;
					}
				},
				{
					field : 'papertype', 
					title : '试卷类型',
					formatter: function(value, row, index) {
						var actions ;
						if(value)  actions='<a class="btn btn-success btn-xs " href="#" >随机</a> ';
						else actions='<a class="btn btn-danger btn-xs " href="#" >固定</a>';
						return actions;
					}
				}]
            };
            $.table.init(options);
        });
 
function lookscore(id){
	$.modal.openTab("成绩与试卷", ctx + "exam/scores/lookscore/"+id);
}

    </script>
</body>
</html>